    package com.lsqingfeng.springboot.controller;

    import com.lsqingfeng.springboot.config.ThirdWeatherConfig;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.core.env.Environment;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;

    /**
     * @className: FirstController
     * @description: 第一个Controller
     * @author: sh.Liu
     * @date: 2022-01-10 15:21
     */
    @RestController
    public class FirstController {

        @Value("${third.weather.url}")
        private String weatherUrl;

        @Autowired
        private Environment env;

        @Autowired
        private ThirdWeatherConfig thirdWeatherConfig;

        @RequestMapping("/hello")
        public String helloWorld(){
            String weatherUrl = thirdWeatherConfig.getUrl();
            System.out.println("获取到的天气地址为：" + weatherUrl);
            System.out.println("获取到的天气城市为：" + thirdWeatherConfig.getCities());
            System.out.println("获取到的天气城市为：" + thirdWeatherConfig.getList());
            return "hello world";
        }
    }
